package com.cosina.game.crystallight.dao;

import android.app.Activity;
import android.content.SharedPreferences;

import com.cosina.game.crystallight.CrystalLightActivity;
import com.cosina.game.crystallight.model.profile.ProfileManager;

public class TollgateDAOFacade {
	
	public static final String NODE_PLAYTIME_PREFIX = "NODE_PLAYTIME_";
	public static final String NODE_BESTSCORE_PREFIX = "NODE_BESTSCORE_";
	
	public static int getPlayTime(String id){
		SharedPreferences sp = get();
		return sp.getInt(NODE_PLAYTIME_PREFIX + id, 0);
	}
	
	public static void savePlayTime(String id,int count){
		SharedPreferences sp = get();
		sp.edit().putInt(NODE_PLAYTIME_PREFIX + id, count);
	}
	
	public static void saveBestSocre(String id,int socre){
		SharedPreferences sp = get();
		sp.edit().putInt(NODE_BESTSCORE_PREFIX + id, socre);
	}
	
	public static int getBestSocre(String id){
		SharedPreferences sp = get();
		return sp.getInt(NODE_BESTSCORE_PREFIX + id, 0);
	}
	
	public static SharedPreferences get(){
		return CrystalLightActivity.self.getSharedPreferences(ProfileManager.getCurrentProfile().name, Activity.MODE_WORLD_WRITEABLE);
	}
}
